package oracle.apps.financials.collection.po;

import greendroid.widget.item.TextItem;
import greendroid.widget.itemview.ItemView;

import java.io.IOException;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.ViewGroup;

import com.cyrilmottier.android.greendroid.R;

public class TextLabelItem extends TextItem {

	public String label;

	public TextLabelItem() {
		this(null);
	}


	public TextLabelItem(String text) {
		this(null, text);
	}

	
	public TextLabelItem(String label, String text) {
		super(text);
		this.label = label;
		enabled = false;
	}

	@Override
	public ItemView newView(Context context, ViewGroup parent) {
		return createCellFromXml(context, R.layout.text_with_label_item_view, parent);
	}

	@Override
	public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs) throws XmlPullParserException, IOException {
		super.inflate(r, parser, attrs);
		TypedArray a = r.obtainAttributes(attrs, R.styleable.SubtextItem);
		label = a.getString(R.styleable.SubtextItem_subtext);
		a.recycle();
	}

}
